﻿using PLCS.Application.Contracts.RoleApp.Dtos;

namespace PLCS.App.UserAuthorization.Converts;

public class UserRolesConvert : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is not List<RoleDto> roleList)
            return null;

        return string.Join(ConstantChar.SplitChar.ToString(),
                           roleList.Select(role => role.RoleName));
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return null;
    }
}